using System;
using System.Collections.Generic;
using System.Text;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.ComponentModel;
using System.Drawing.Design;
using System.Net;
using System.IO;
using System.Threading;
using System.Web.Security;

namespace ExtraClub.Domain {
    public class FormHolder : PlaceHolder {
        #region Properties
        public string FormName { get; set; }
        #endregion

        #region Method
        public void LoadForm(string requestedFormName) {
            if (!string.IsNullOrEmpty(FormName) && requestedFormName == FormName) {
                try {
                    Control control = this.Page.LoadControl(string.Format("~/modules/forms/{0}/module.ascx", FormName));
                    this.Controls.Add(control);
                } catch (Exception ex) {
                    Literal err = new Literal();
                    err.Text = string.Format(@"
<div style='margin:5px;padding:5px; border:solid 4px #777;color:red; background:#eee;'>
<p>Error:{0}</p>
</div>", ex.Message);
                    this.Controls.Add(err);
                }
            }
        }
        #endregion
    }
}
